<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" type="text/css" href="/css/style.css">
</head>

<body>


	<%- include ('header.ejs') %>

	<div class="box">

		<ul class="news">
			<li>
				<div class="uinfo">
					<a href="#">

						<img src="/img/<%-articles.user.avatar%>">

						<div><%- articles.user.username%></div>
					</a>
				</div>

				<div class="cbox">
					<div class="content">
						<a href="#">
							<p><%- articles.title %></p>
							<p>
								<%- articles.content %>
							</p>
						</a>
					</div>
					<div>
						<span><%- articles.createTime %></span>
						<span>浏览(10)</span>
						<span>评论(8)</span>
					</div>
				</div>
			</li>

			<% if(user){ %>
			<li>
				<div class="uinfo"></div>

				<div class="post">
					<form action="/comment/addComment" method="POST">
						<div>
							<textarea class="commont_area" name="comment"></textarea>
						</div>
						<input type="hidden" name="articleId" value="<%- articles._id%>">
						<input type="hidden" name="userId" value="<%- user._id%>">
						<div>
							<input type="submit" value="发表评论">
						</div>

					</form>
				</div>

			</li>
			<% } %>

			<li>
				<div class="uinfo">


				</div>

				<div class="commentlist">
					<ul>

						<%	for(let i=0;i<comments.length;i++){ %>
						<li>
							<div>
								<img src="/img/<%-comments[i].user.avatar%>">
								<div class="comment">
									<div>
										<span class="username">用户名：<%-comments[i].user.username%></span>
										<span><%- comments[i].comment %></span>
									</div>

									<div class="other">
										<span><% comments[i].createTime %></span>
										<span>点赞(99)</span>
									</div>
								</div>
							</div>
						</li>

						<% } %>



					</ul>
				</div>

			</li>
		</ul>




	</div>
</body>

</html>